home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / liboctave / CRowVector.h < prev    next >
C/C++ Source or Header  |  1997-03-07  |  6KB  |  177 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_ComplexRowVector_h)
  24. #define octave_ComplexRowVector_h 1
  25.  
  26. #if defined (__GNUG__)
  27. #pragma interface
  28. #endif
  29.  
  30. #include "MArray.h"
  31.  
  32. #include "mx-defs.h"
  33.  
  34. class ComplexRowVector : public MArray<Complex>
  35. {
  36. friend class ComplexColumnVector;
  37.  
  38. public:
  39.  
  40.   ComplexRowVector (void) : MArray<Complex> () { }
  41.   ComplexRowVector (int n) : MArray<Complex> (n) { }
  42.   ComplexRowVector (int n, const Complex& val) : MArray<Complex> (n, val) { }
  43.   ComplexRowVector (const RowVector& a);
  44.   ComplexRowVector (const MArray<Complex>& a) : MArray<Complex> (a) { }
  45.   ComplexRowVector (const ComplexRowVector& a) : MArray<Complex> (a) { }
  46.  
  47.   ComplexRowVector& operator = (const ComplexRowVector& a)
  48.     {
  49.       MArray<Complex>::operator = (a);
  50.       return *this;
  51.     }
  52.  
  53.   bool operator == (const ComplexRowVector& a) const;
  54.   bool operator != (const ComplexRowVector& a) const;
  55.  
  56.   // destructive insert/delete/reorder operations
  57.  
  58.   ComplexRowVector& insert (const RowVector& a, int c);
  59.   ComplexRowVector& insert (const ComplexRowVector& a, int c);
  60.  
  61.   ComplexRowVector& fill (double val);
  62.   ComplexRowVector& fill (const Complex& val);
  63.   ComplexRowVector& fill (double val, int c1, int c2);
  64.   ComplexRowVector& fill (const Complex& val, int c1, int c2);
  65.  
  66.   ComplexRowVector append (const RowVector& a) const;
  67.   ComplexRowVector append (const ComplexRowVector& a) const;
  68.  
  69.   ComplexColumnVector hermitian (void) const;  // complex conjugate transpose.
  70.   ComplexColumnVector transpose (void) const;
  71.  
  72.   friend ComplexRowVector conj (const ComplexRowVector& a);
  73.  
  74.   // resize is the destructive equivalent for this one
  75.  
  76.   ComplexRowVector extract (int c1, int c2) const;
  77.  
  78.   // row vector by row vector -> row vector operations
  79.  
  80.   ComplexRowVector& operator += (const RowVector& a);
  81.   ComplexRowVector& operator -= (const RowVector& a);
  82.  
  83.   ComplexRowVector& operator += (const ComplexRowVector& a);
  84.   ComplexRowVector& operator -= (const ComplexRowVector& a);
  85.  
  86.   // row vector by scalar -> row vector operations
  87.  
  88.   friend ComplexRowVector operator + (const ComplexRowVector& a, double s);
  89.   friend ComplexRowVector operator - (const ComplexRowVector& a, double s);
  90.   friend ComplexRowVector operator * (const ComplexRowVector& a, double s);
  91.   friend ComplexRowVector operator / (const ComplexRowVector& a, double s);
  92.  
  93.   friend ComplexRowVector operator + (const RowVector& a, const Complex& s);
  94.   friend ComplexRowVector operator - (const RowVector& a, const Complex& s);
  95.   friend ComplexRowVector operator * (const RowVector& a, const Complex& s);
  96.   friend ComplexRowVector operator / (const RowVector& a, const Complex& s);
  97.  
  98.   // scalar by row vector -> row vector operations
  99.  
  100.   friend ComplexRowVector operator + (double s, const ComplexRowVector& a);
  101.   friend ComplexRowVector operator - (double s, const ComplexRowVector& a);
  102.   friend ComplexRowVector operator * (double s, const ComplexRowVector& a);
  103.   friend ComplexRowVector operator / (double s, const ComplexRowVector& a);
  104.  
  105.   friend ComplexRowVector operator + (const Complex& s, const RowVector& a);
  106.   friend ComplexRowVector operator - (const Complex& s, const RowVector& a);
  107.   friend ComplexRowVector operator * (const Complex& s, const RowVector& a);
  108.   friend ComplexRowVector operator / (const Complex& s, const RowVector& a);
  109.  
  110.   // row vector by matrix -> row vector
  111.  
  112.   friend ComplexRowVector operator * (const ComplexRowVector& a,
  113.                       const ComplexMatrix& b);
  114.  
  115.   friend ComplexRowVector operator * (const RowVector& a,
  116.                       const ComplexMatrix& b);
  117.  
  118.   // row vector by row vector -> row vector operations
  119.  
  120.   friend ComplexRowVector operator + (const ComplexRowVector& a,
  121.                       const RowVector& b);
  122.   friend ComplexRowVector operator - (const ComplexRowVector& a,
  123.                       const RowVector& b);
  124.  
  125.   friend ComplexRowVector operator + (const RowVector& a,
  126.                       const ComplexRowVector& b);
  127.   friend ComplexRowVector operator - (const RowVector& a,
  128.                       const ComplexRowVector& b);
  129.  
  130.   friend ComplexRowVector product (const ComplexRowVector& a,
  131.                    const RowVector& b);
  132.   friend ComplexRowVector quotient (const ComplexRowVector& a,
  133.                     const RowVector& b);
  134.  
  135.   friend ComplexRowVector product (const RowVector& a,
  136.                    const ComplexRowVector& b);
  137.   friend ComplexRowVector quotient (const RowVector& a,
  138.                     const ComplexRowVector& b);
  139.  
  140.   // other operations
  141.  
  142.   ComplexRowVector map (c_c_Mapper f) const;
  143.   RowVector map (d_c_Mapper f) const;
  144.  
  145.   ComplexRowVector& apply (c_c_Mapper f);
  146.  
  147.   Complex min (void) const;
  148.   Complex max (void) const;
  149.  
  150.   // i/o
  151.  
  152.   friend ostream& operator << (ostream& os, const ComplexRowVector& a);
  153.   friend istream& operator >> (istream& is, ComplexRowVector& a);
  154.  
  155. private:
  156.  
  157.   ComplexRowVector (Complex *d, int l) : MArray<Complex> (d, l) { }
  158. };
  159.  
  160. // row vector by column vector -> scalar
  161.  
  162. Complex operator * (const ComplexRowVector& a, const ColumnVector& b);
  163.  
  164. Complex operator * (const ComplexRowVector& a, const ComplexColumnVector& b);
  165.  
  166. // other operations
  167.  
  168. ComplexRowVector linspace (const Complex& x1, const Complex& x2, int n);
  169.  
  170. #endif
  171.  
  172. /*
  173. ;;; Local Variables: ***
  174. ;;; mode: C++ ***
  175. ;;; End: ***
  176. */
  177.